<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //console.log(1);
    /*for(let i=1; i<101; i++){
        console.log(i);
    }*/
   //计算1~100的总和
    let nun = 0;
    for(vari=1; i<=100;i++){
        nun += i;
    }
    console.log('总和为：' + nun);
    console.log('-----------------');
    //while循环和 do...while循环
    let i = 1;
    while(i<101){
        console.log(i);
        i++;
    }
    console.log('-------------------');
    //只打印偶数
    let p = 0;
    while(p<=100){
        if(p%2==0){
            console.log(p);  //0
        }
        p++;  //1 2
    }
    console.log('--------------------');
    let a = 10;
    while(a<10){
        console.log('执行while循环');
    }
    let b = 10;
    do{
        console.log('执行do...while循环');
    }while(b<10)
    //打印九九乘法表
    let str = '';
    for(let i = 0; i<4; i++){
        str = '';
        for(let j=0; j<5; j++){
            str += '*';
        }
        console.log(str+'\n');
    }
</script>
</html>